package com.rj.bd.controller;
/**
 * 
 * @author FTY
 *
 */

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.rj.bd.entity.Class1;
import com.rj.bd.entity.User;
import com.rj.bd.service.IClassService;

@RestController
@ResponseBody
@CrossOrigin
public class ClassController {

	@Autowired
	private IClassService classService;
	
	/**
	 * 查询全部
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/class/queryAll")
	public Map<String,Object>queryAll(HttpServletRequest request){
        System.out.println("ClasssController--->queryAll()");
        Map<String, Object> map = new HashMap<String, Object>();
        
        List<Class1>list=classService.queryAll();
        
        map.put("code", 0);
        map.put("msg", "请求成功");
        map.put("data", list);
        return map;
    }
	
	/**
	 * 查询一条
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/class/queryById")
	public Map<String,Object>queryById(@RequestParam ("cid") String cid){
        System.out.println("ClasssController--->queryById()");
        Map<String, Object> map = new HashMap<String, Object>();
        
        List<Class1>list=classService.queryById(cid);
        
        map.put("code", 0);
        map.put("msg", "请求成功");
        map.put("data", list);
        return map;
    }
	
}
